<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <style>
        .aui-bar-nav {
            background: none;
        }

        body {
            background-color: #F2F2F2;
        }

        .aui-bar-nav .aui-iconfont {
            font-weight: bold;
        }
    </style>
</head>

<body>
    <div class="home-header">
        <header data-color="light" id="header" class="aui-bar aui-bar-nav">
            <a class="aui-pull-left aui-btn" tapmode onclick="comeBack()">
                <span class="aui-iconfont aui-icon-left"></span>
            </a>
            <div class="aui-title">个人中心</div>
        </header>
    </div>
    <div class="aui-content home">
        <div class="top-box">
            <div class="top">
                <div class="left"><img src="../icon/logo.png"></div>
                <div class="right">
                    <!-- <div>张三</div> -->
                    <p>ID：<span id="nameID">001</span></p>
                </div>
            </div>
            <div class="bottom">
                <div class="left">
                    <p>可用余额(元)</p>
                    <span id="mymoney">0.00</span>
                </div>
                <div tapmode onclick="openWin('money_ti')" class="right">立即提现</div>
            </div>
        </div>
        <div class="bottom-box">
            <ul class="aui-list aui-list-in" tapmode onclick="listGroup()">
                <li class="aui-list-item aui-list-item-middle" data-page="bind_account">
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-label-icon">
                            <img src="../image/18.png">
                        </div>
                        <div class="aui-list-item-inner">
                            绑定支付宝
                        </div>
                    </div>
                </li>
                <li class="aui-list-item aui-list-item-middle" tapmode data-page="bind_phone">
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-label-icon">
                            <img src="../image/19.png">
                        </div>
                        <div class="aui-list-item-inner">
                            绑定手机号
                        </div>
                    </div>
                </li>
                <li class="aui-list-item aui-list-item-middle" tapmode data-page="income_details">
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-label-icon">
                            <img src="../image/20.png">
                        </div>
                        <div class="aui-list-item-inner">
                            收益明细
                        </div>
                    </div>
                </li>
                <li class="aui-list-item aui-list-item-middle" tapmode data-page="outlogin">
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-label-icon">
                            <img src="../image/20.png">
                        </div>
                        <div class="aui-list-item-inner">
                            退出登录
                        </div>
                    </div>
                </li>
            </ul>

        </div>

    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../script/md5.min.js"></script>
<script type="text/javascript">
    apiready = function() {
        initHeard();
        getPageInit();
        console.log(api.frameName)
    };
    //事件委托页面跳转
    function listGroup(event) {
        var event = event || window.event;
        var el = event.target;
        while (el.tagName !== 'LI') {
            if (el === document.getElementsByClassName("aui-list")[0]) {
                el = null;
                break;
            }
            el = el.parentNode; //返回當前元素的父节点
        }
        if (el) {
            var atype = el.getAttribute("data-page");
            if (atype == 'outlogin') {
                out();
                // alert("事件委托页面跳转失败")
                openWin('login', null, false);
                api.closeFrame();
            } else {
                openWin(atype)
            }
        }
    };
    //获取金额
    function getPageInit() {
        var userInfo = $api.getStorage('user');
        console.log(userInfo)
        userInfo = JSON.parse(userInfo)
        $("#nameID").html(userInfo.id);
        _ajax("index/income", {}, function(res, err) {
            console.log(JSON.stringify(res))
            if (res) {
                console.log(res);
                if (res.errCode == 1) {
                    var money = Number(res.data.user_money);
                    if (money) {
                        $("#mymoney").html(money.toFixed(2));
                    }
                } else if (res.errCode == -1) {
                    // alert("获取金额 失败")
                    openWin('login');
                } else {
                    _msg(res.msg);
                }
            } else {
                _msg("网络错误");
            }
        })
    };
</script>

</html>
